import com.sun.org.apache.xpath.internal.objects.XString;
import org.omg.CosNaming.IstringHelper;

import java.sql.*;

public class JDBCTest1 {
    public static void main(String[] args) throws ClassNotFoundException, SQLException {

        Class.forName("com.mysql.cj.jdbc.Driver");

        String url = "jdbc:mysql://localhost:3306/homework?useUnicode=true&characterEncoding=utf8&useSSL=true";
        String name = "root";
        String password = "159357ss";

        Connection connection = (Connection) DriverManager.getConnection(url,name,password);

        Statement statement = connection.createStatement();
        String sql = "SELECT*FROM student";
        ResultSet resultSet = statement.executeQuery(sql);
        while(resultSet.next()){
            String one = resultSet.getString(1);
            String two = resultSet.getString(2);
            String three = resultSet.getString(3);
            System.out.println( three+"班"+one+"芳龄"+two);}
        resultSet.close();
        statement.close();
        connection.close();


    }

}